package com.zp.oj.judge.CodeSandBox.impl;

import com.zp.oj.judge.CodeSandBox.CodeSandBox;
import com.zp.oj.judge.model.ExecuteCodeRequest;
import com.zp.oj.judge.model.ExecuteCodeSandResponse;
import com.zp.oj.judge.model.JudgeInfo;
import com.zp.oj.model.enums.JudgeInfoEnum;
import com.zp.oj.model.enums.QuestionSubmitLanguageEnum;
import com.zp.oj.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * 示例代码沙箱(测试用)
 */
public class ExampleCodeSandBox implements CodeSandBox {
    @Override
    public ExecuteCodeSandResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        List<String> inputs = executeCodeRequest.getInputs();
        ExecuteCodeSandResponse executeCodeSandResponse = new ExecuteCodeSandResponse();
        executeCodeSandResponse.setOutputs(inputs);
        executeCodeSandResponse.setMessage("执行成功");
        executeCodeSandResponse.setStatus(QuestionSubmitStatusEnum.SUCCESS.getValue());
        executeCodeSandResponse.setLanguage(QuestionSubmitLanguageEnum.JAVA.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoEnum.ACCEPT.getValue());
        judgeInfo.setTime(1000L);
        judgeInfo.setMemory(1000L);
        
        executeCodeSandResponse.setJudgeInfo(judgeInfo);
        
        return executeCodeSandResponse;
    }
}
